package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._02策略模式._1基本代码;

/**
 * @ClassName Context
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/9 11:26 PM
 * @Version 1.0
 */

//上下文
public class Context {
    Strategy strategy;     //初始化时，传入具体的策略对象

    public Context(Strategy strategy) {
        this.strategy = strategy;
    }

    //上下文接口
    public void contextInterface() {        //根据具体的策略对象，调用其算法的方法
        strategy.algorithmInterface();
    }
}
